package popcorn.ticket.dao;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import popcorn.ticket.entity.MovieComment;
import popcorn.ticket.entity.MovieCommentExample;

@Repository
public interface MovieCommentMapper {
	long countByExample(MovieCommentExample example);

	int deleteByExample(MovieCommentExample example);

	int deleteByPrimaryKey(Integer commentid);

	int insert(MovieComment record);

	int insertSelective(MovieComment record);

	List<MovieComment> selectByExample(MovieCommentExample example);

	MovieComment selectByPrimaryKey(Integer commentid);

	int updateByExampleSelective(@Param("record") MovieComment record, @Param("example") MovieCommentExample example);

	int updateByExample(@Param("record") MovieComment record, @Param("example") MovieCommentExample example);

	int updateByPrimaryKeySelective(MovieComment record);

	int updateByPrimaryKey(MovieComment record);

	/**
	 * 批量禁用用户
	 * @param idList
	 * @return
	 */
	int updateStatus(List idList);

	/**
	 * 根据电影名查询影评信息
	 * @param keywords
	 * @return
	 */
	List<MovieComment> selectByAll(String keywords);

	/**
	 * 获取电影的平均分数
	 * @return
	 */
	double getAVGMovueScore(int movieid);
	
	/**
	 * 获取单个用户的所有评论
	 * @param userid
	 * @return
	 */
	List<MovieComment> selectCommentByUserid(int userid);
	
	/**
	 * 根据movieid进行查询
	 * @param movieid
	 * @return
	 */
	List<MovieComment> selectMCByMI(int movieid);
	
	/**
	 * 高分排行榜
	 * @return
	 */
	List<MovieComment> getListByScore();
	
	/**
	 * 查询在某个时间段内的影评
	 * 
	 * @param string
	 * @param string2
	 * @return
	 */
	List<MovieComment> getCommnetsByTimeSlot(@Param("startTime") String startTime, @Param("endTime") String endTime,
		@Param("keywords") String keywords,	@Param("moviename") String 
moviename, @Param("userid") int userid, @Param("username") String username);


}